/**  

* @Title: AdministratorDaoHibernate.java 

* @Package com.gxbadge.dao.impl 

* @Description: TODO(用一句话描述该文件做什么) 

* @author CST

* @version V1.0  

*/ 

package com.gxbadge.dao.impl;

import java.util.List;

import com.gxbadge.dao.ImageInfoDao;
import com.gxbadge.dao.base.BaseHibernateDaoSupport;
import com.gxbadge.model.Image;
import com.gxbadge.model.ImageInfo;
import com.gxbadge.model.Navigation;

public class ImageInfoDaoHibernate extends BaseHibernateDaoSupport implements ImageInfoDao {

	/* 
	 * {见接口方法说明}
	 */
	public void delete(ImageInfo imageInfo) {
		
		this.getHibernateTemplate().delete(imageInfo);
		
	}

	/* 
	 * {见接口方法说明}
	 */
	public List<ImageInfo> findImageInfoAll() {
		
		
		return null;
	}

	/* 
	 * {见接口方法说明}
	 */
	public ImageInfo findImageInfoByImageInfoId(Integer imageInfoId) {
		
		ImageInfo imageInfo = this.getHibernateTemplate().get(ImageInfo.class, imageInfoId);
		if(imageInfo!=null){
			return imageInfo;
		}
		return null;
	}

	/* 
	 * {见接口方法说明}
	 */
	public void save(ImageInfo imageInfo) {
		
		this.getHibernateTemplate().save(imageInfo);
		
	}

	/* 
	 * {见接口方法说明}
	 */
	public void update(ImageInfo imageInfo) {
		
		this.getHibernateTemplate().update(imageInfo);
		
	}

	public ImageInfo findImageInfoByImage(Image image){
		
		List<ImageInfo> imageInfoList = this.getHibernateTemplate().find("from ImageInfo as i where i.image=?", image);
		if(imageInfoList!=null&&imageInfoList.size()>=1){
			return imageInfoList.get(0);
		}
		return null;
		
	}
	
	

}
